function transform(text) {
  // write code here
  const exp = /\w+(?=元)/g

  const value = text.replace(exp, intToChinese)
  const aa = value.replace(/元/g, '')
  return aa
}
function intToChinese(num) {
  if (!/^\d*(\.\d*)?$/.test(num)) {
    // alert("Number is wrong!");
    return 'Number is wrong!'
  }
  const AA = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
  const BB = ['', '十', '佰', '千', '万', '亿', '点', '']
  let a = ('' + num).replace(/(^0*)/g, '').split('.'),
    k = 0,
    re = ''
  for (let i = a[0].length - 1; i >= 0; i--) {
    switch (k) {
      case 0:
        re = BB[7] + re
        break
      case 4:
        if (!new RegExp('0{4}\\d{' + (a[0].length - i - 1) + '}$').test(a[0])) {
          re = BB[4] + re
        }
        break
      case 8:
        re = BB[5] + re
        BB[7] = BB[5]
        k = 0
        break
    }
    if (k % 4 == 2 && a[0].charAt(i + 2) != 0 && a[0].charAt(i + 1) == 0) {
      re = AA[0] + re
    }
    if (a[0].charAt(i) != 0) {
      re = AA[a[0].charAt(i)] + BB[k % 4] + re
    }
    k++
  }
  if (a.length > 1) {
    // 加上小数部分(如果有小数部分)
    re += BB[6]
    for (let i = 0; i < a[1].length; i++) {
      re += AA[a[1].charAt(i)]
    }
  }
  if (re + '圆' == '圆') {
    return '零圆整'
  }
  return re + '圆'
}
// transform('本次采购的商品有110件”，采购的价格为0元的10件属于赠送商品，采购价格为9999元的100件是实际购买商品，本次采购总价为999900元。')

function test() {
  let a = 0
  return function() {
    console.log(a++)
  }
}
const c = test()
const d = test()
/*
 * c()
 * c()
 * d()
 */

function cssStyle2DomStyle(sName) {
  // 填写JavaScript

  sName = sName.split('')
  let index = sName.indexOf('-')
  while (index != -1) {
    sName.splice(index, 2, sName[index + 1].toUpperCase())
    index = sName.indexOf('-')
  }
  sName.splice(0, 1, sName[0].toLowerCase())
  return sName.join('')
}


function containsRepeatingLetter(str) {
  const rex = /([A-Z]|[a-z])(\1)/
  return rex.test(str)
}
// console.log(containsRepeatingLetter('111ac'))

// function fn() {
//   let n = 99
//   add = function() {
//     n++
//   }
//   function fn1() {
//     console.log(n)
//   }
//   return fn1
// }
// const result = fn()
// result()
// add()
// result()
